oracle.pg.common

## Class LocalizedMessage

- java.lang.Object
- - oracle.pg.common.LocalizedMessage

- Direct Known Subclasses:
    Message

      public abstract class LocalizedMessage
      extends Object

  This class represents a message which may be localized based on a Java Locale and may additionally be parameterized by substituting values for certain patterns in the source string. It can be used in conjunction with exceptions, for example, to provide Locale-sensitive error messages. You should subclass this class to provide a message implementation for each resource bundle family.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `LocalizedMessage(String errorCode)` Constructor for error code and non-parameterized message.
    `LocalizedMessage(String errorCode, Object parameter)` Constructor for error code and one-parameter message.
    `LocalizedMessage(String errorCode, Object[] parameterArray)` Constructor for error code and many-parameter message.
    `LocalizedMessage(String errorCode, Object parameter1, Object parameter2)` Constructor for error code and two-parameter message.
    `LocalizedMessage(String errorCode, Object parameter1, Object parameter2, Object parameter3)` Constructor for error code and three-parameter message.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getErrorCode()` Returns the error code number as an String.
    `Locale` | `getLocale()` Gets the Locale that will be used to deliver this message.
    `String` | `getMessage()` Returns the localized message using the Locale set in the setLocale() method (or the default Locale if not applicable) and substituting any parameters passed into the constructor.
    `void` | `setLocale(Locale l)` Sets the Locale that will be used to deliver this message.
    `String` | `toString()` Returns the string representation of the message

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### LocalizedMessage

          public LocalizedMessage(String errorCode)

      Constructor for error code and non-parameterized message.

    - #### LocalizedMessage

          public LocalizedMessage(String errorCode,
                          Object parameter)

      Constructor for error code and one-parameter message.

    - #### LocalizedMessage

          public LocalizedMessage(String errorCode,
                          Object[] parameterArray)

      Constructor for error code and many-parameter message.

    - #### LocalizedMessage

          public LocalizedMessage(String errorCode,
                          Object parameter1,
                          Object parameter2)

      Constructor for error code and two-parameter message.

    - #### LocalizedMessage

          public LocalizedMessage(String errorCode,
                          Object parameter1,
                          Object parameter2,
                          Object parameter3)

      Constructor for error code and three-parameter message.

  - ### Method Detail

    - #### getErrorCode

          public String getErrorCode()

      Returns the error code number as an String.

    - #### getLocale

          public Locale getLocale()

      Gets the Locale that will be used to deliver this message. A null value indicates that the default Locale will be used.

    - #### getMessage

          public String getMessage()

      Returns the localized message using the Locale set in the setLocale() method (or the default Locale if not applicable) and substituting any parameters passed into the constructor. The string retrieved is dependent on the error code supplied in the constructor as well as the resource bundle family name provided by the subclass implementation of getResourceBundleName().

    - #### setLocale

          public void setLocale(Locale l)

      Sets the Locale that will be used to deliver this message. Set the Locale to null (or don't set it at all) in order to use the default Locale for this JVM.

    - #### toString

          public String toString()

      Returns the string representation of the message
      Overrides:
        `toString` in class `Object`

Copyright © 2015 Oracle and/or its afflilates. All Rights Reserved.